<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html class="pixel-ratio-2 retina android android-6 android-6-0">
<head>
<title>游戏代理后台</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1, user-scalable=no">

<meta name="description" content="">

<link rel="stylesheet" href="${ctx }/templates/default/skins/default/h5/lib/weui.min.css">
<link rel="stylesheet" href="${ctx }/templates/default/skins/default/h5/css/jquery-weui.css">
<link rel="stylesheet" href="${ctx }/templates/default/skins/default/h5/css/lehe.css">
<script type="text/javascript">
	navigator
			.__defineGetter__(
					'userAgent',
					function() {
						return 'Mozilla/5.0 (Linux; U; Android 2.3.6; zh-cn; GT-S5660 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 MicroMessenger/4.5.255';
					});
</script>
<style>
.mybtn{
background-color: rgb(26, 173, 25);
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    box-sizing: border-box;
    color: rgb(255, 255, 255);
    cursor: pointer;
    display: inline-block;
    font-family: -apple-system-font, "Helvetica Neue", Helvetica, sans-serif;
    font-size: 13px;
    height: 29px;
    line-height: 29.9px;
    margin-bottom: 0px;
    margin-left: 0px;
    margin-right: 0px;
    margin-top: 15px;
    overflow-x: hidden;
    overflow-y: hidden;
    padding-bottom: 0px;
    padding-left: 17.16px;
    padding-right: 17.16px;
    padding-top: 0px;
    position: relative;
    text-align: center;
    text-decoration-color: rgb(255, 255, 255);
    text-decoration-line: none;
    text-decoration-style: solid;
    text-size-adjust: 100%;
    width: 120.3125px;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
</style>
</head>

<body ontouchstart="">
	<heaer>
	<div class="header">
		<a href="${ctx }/main" class="title"> <span
			class="header-icon4"></span>
		</a> <span class="title-txt J-title-txt">申请列表</span>
	</div>
	<div class="header-secondary"></div>
	</heaer>

	<div id="list" class="lehe-content-padded">
	</div>

	<div id="loading" class="weui-loadmore" style="display: none;">
		<i class="weui-loading"></i><span class="weui-loadmore__tips">正在加载</span>
	</div>
	
	<script src="${ctx }/templates/default/skins/default/h5/lib/jquery-2.1.4.js"></script>
	<script src="${ctx }/templates/default/skins/default/h5/lib/fastclick.js"></script>
	<script>
		$(function() {
			FastClick.attach(document.body);
		});
	</script>
	<script src="${ctx }/templates/default/skins/default/h5/js/jquery-weui.js"></script>


	<script>
		var ctx = "${ctx}";
		var dataUrl = "/xh_wx/xh_applyDetailListData";
		
		$(function() {
			FastClick.attach(document.body);
		});
		
		$(document.body).infinite(150).on("infinite", function() {
			console.log("infinite...")
			loadPages();
		});
		
		var defaultImg = "https://res.wx.qq.com/a/wx_fed/common_assets/16120602/win_weixin21/images/phone_logo2x.png";
		var page = 1;
		var pagesize = 10;
		var loading = false;
		$("#loading").hide();

		loadPages();

		

		function loadPages() {
			if (loading)
				return;
			loading = true;
			$("#loading").show();
			$.post(ctx+dataUrl,{
					page : page,
					pagesize : pagesize,
					btime:"${btime}",
					passflag:"${passFlag}",
					etime:"${etime}"
				},function(result){callback(result);}
			);
		}
		
		function callback(result) {
			var data = result;
			var row = data;
			var l = row.length;
			if (l > 0) {
				page++;
				$("#list #nomore").remove()
			} else {
				var nodataTip = '<div id="nomore" class="weui-loadmore weui-loadmore_line">'
						+ '<span class="weui-loadmore__tips">没有更多数据了</span>'
						+ '</div>';
				$("#loading").hide();
				$("#list").append(nodataTip);
				return;//没有下一夜数据了，没有设置loading为false，保证下次触发翻页时不再加载数据
			}
			for (var i = 0; i < l; i++) {
				var rs = row[i];
				var busiName = "";
				var txt = rs.passFlag==0?('<span class="mybtn" onclick="pass('+rs.userID+')">点击通过</span><p>'+rs.checkInTime  + '</p>'):
                	('已通过<p>'+rs.checkInTime  + '</p>');
				var allCount = parseFloat(rs.myPayCount) + parseFloat(rs.myGoldPayCount);
				$("#list").append(
                        '<a class="weui-cell " > '
                        + '<div class="weui-cell__bd"> '
                        + '申请人：'+rs.trueName+" <br/>微信：" + rs.wxCode
                        + ' <br/>手机：<span class="lehe-sub-title-info">'
                        + rs.mobile
                        + '<span> </div> '
                        + '<div class="weui-cell__ft">'
                        + txt
                        + '</div> </a>');

			}
			$("#loading").hide();
			loading = false;
		}
		
		function pass(userId){
			console.log(userId);
			
			$.post(ctx+"/xh_wx/xh_applyPass",{
				userId:userId
			},function(result){
				console.log(result)
				if(result.messageCode == 1){
					$.toast("查询用户失败:"+result.messageValue, "forbidden");
				}else{
					$("#list").empty();
					page = 1;
					loadPages();
				}
				
			}
		);
		}
	</script>
</body>
</html>